#pragma once

#include <cstdint>
#include <memory>

#include "IBitmapData.h"
#include "ImportExport.h"

namespace FTLib
{
	enum class LoadDataFormat
	{
		Invalid,
		WIC,
		CSV,
		BINARY
	};

	enum class SaveDataFormat
	{
		Invalid,
		PNG,
		TIFF,
		WDP,	// JPG-XR
		CSV,
		BINARY,
		FROM_EXTENSION
	};

	class loadsavedata_exception : std::exception
	{
	private:
		std::wstring msg;
	public:
		loadsavedata_exception(const wchar_t* errorMsg) :msg(errorMsg){};
		loadsavedata_exception(const std::wstring& errorMsg) :msg(errorMsg){};

		const std::wstring& getErrorMessage() const { return this->msg; }
	};

	std::shared_ptr<IBitmapData> FTLIB_API ReadDataAsFloat32(const wchar_t* szwFilename, LoadDataFormat fmt = LoadDataFormat::Invalid);

	std::shared_ptr<IBitmapData> FTLIB_API CreateRandomFloat32(uint32_t width, uint32_t height, FTLib::PixelType pixelType, float low, float high, uint32_t seed);

	void FTLIB_API SaveData(const wchar_t* szwFilename, std::shared_ptr<IBitmapData> bm, SaveDataFormat fmt = SaveDataFormat::Invalid);
}